// pages/collectsite/collectsite.js
let network = require("../../utils/network.js")
const app = getApp();
var url = app.globalData.url;


Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    mine:null
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      var that = this
    if (options.mine == 'mine'){
        that.setData({
          mine: options.mine
        })
      }

  },

  // 收货地址
  addressList(){
    var that = this
    network.request({
      url: url + '/AppletsApi/Address/addressList.html',
      data: {
        applet_openid: wx.getStorageSync('applet_openid'),
      },
      method: 'post',
      header: {
        "content-type": "application/x-www-form-urlencoded"
      },
      success: function (data) {
        that.setData({
          list: data.data.data
        })
        console.log(data.data.data)
      }
    })
  },

  
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that =this
    that.addressList()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  confirmorder(e) {
    let that = this;
    app.globalData.address = e.currentTarget.dataset.address
    console.log(app.globalData.address)
    wx.navigateBack({
      delta: 1
    })
  }
})